<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :before-close="crud.cancelCU"
    :visible="crud.status.cu > 0"
    :title="crud.status.title"
    width="500px"
  >
    <el-form
      ref="form"
      :model="form"
      :rules="rules"
      size="small"
      label-width="80px"
    >
      <el-form-item
        label="会员号"
        prop="customerId"
      >
        <el-input
          v-model="form.customerId"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="会员名称"
        prop="customerName"
      >
        <el-input
          v-model="form.customerName"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="会员手机"
        prop="phoneNum"
      >
        <el-input
          v-model="form.phoneNum"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="货物名称"
        prop="resourceName"
      >
        <el-input
          v-model="form.resourceName"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="重量"
        prop="weight"
      >
        <el-input
          v-model="form.weight"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="委托地点"
        prop="startPoint"
      >
        <el-input
          v-model="form.startPoint"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="运输终点"
        prop="endPoint"
      >
        <el-input
          v-model="form.endPoint"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="收货人"
        prop="recive"
      >
        <el-input
          v-model="form.recive"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="货物图片"
        prop="img"
      >
        <el-input
          v-model="form.img"
          style="width: 370px;"
        />
      </el-form-item>

      <el-form-item
        label="备注"
        prop="remark"
      >
        <el-input
          v-model="form.remark"
          style="width: 370px;"
        />
      </el-form-item>

    </el-form>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="text"
        @click="crud.cancelCU"
      >
        取消
      </el-button>
      <el-button
        :loading="crud.cu === 2"
        type="primary"
        @click="crud.submitCU"
      >
        确认
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
  import CRUD, { form } from '@crud/crud'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'

  const defaultForm = {
    id: null,
    name: '',
    sort: 999,
    enabled: true,
    dept: {
      id: 1
    }
  }
  export default {
    mixins: [form(defaultForm)],
    props: {

    },
    data() {
      return {
        rules: {
          name: [
            { required: true, message: '请输入名称', trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      [CRUD.HOOK.beforeToCU]() {

      },
      // 提交前的验证
      [CRUD.HOOK.afterValidateCU]() {

        return true
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
